/**
 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package fr.smile.liferay.portlet.news.service.persistence;

import com.liferay.portal.kernel.bean.PortletBeanLocatorUtil;
import com.liferay.portal.kernel.dao.orm.DynamicQuery;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.service.ServiceContext;

import fr.smile.liferay.portlet.news.model.NewsFlag;

import java.util.List;

/**
 * The persistence utility for the news flag service. This utility wraps {@link NewsFlagPersistenceImpl} and provides direct access to the database for CRUD operations. This utility should only be used by the service layer, as it must operate within a transaction. Never access this utility in a JSP, controller, model, or other front-end class.
 *
 * <p>
 * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
 * </p>
 *
 * <p>
 * Caching information and settings can be found in <code>portal.properties</code>
 * </p>
 *
 * @author Brian Wing Shun Chan
 * @see NewsFlagPersistence
 * @see NewsFlagPersistenceImpl
 * @generated
 */
public class NewsFlagUtil {
	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#clearCache()
	 */
	public static void clearCache() {
		getPersistence().clearCache();
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel)
	 */
	public static void clearCache(NewsFlag newsFlag) {
		getPersistence().clearCache(newsFlag);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
	 */
	public long countWithDynamicQuery(DynamicQuery dynamicQuery)
		throws SystemException {
		return getPersistence().countWithDynamicQuery(dynamicQuery);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
	 */
	public static List<NewsFlag> findWithDynamicQuery(DynamicQuery dynamicQuery)
		throws SystemException {
		return getPersistence().findWithDynamicQuery(dynamicQuery);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int)
	 */
	public static List<NewsFlag> findWithDynamicQuery(
		DynamicQuery dynamicQuery, int start, int end)
		throws SystemException {
		return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
	 */
	public static List<NewsFlag> findWithDynamicQuery(
		DynamicQuery dynamicQuery, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		return getPersistence()
				   .findWithDynamicQuery(dynamicQuery, start, end,
			orderByComparator);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#remove(com.liferay.portal.model.BaseModel)
	 */
	public static NewsFlag remove(NewsFlag newsFlag) throws SystemException {
		return getPersistence().remove(newsFlag);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)
	 */
	public static NewsFlag update(NewsFlag newsFlag, boolean merge)
		throws SystemException {
		return getPersistence().update(newsFlag, merge);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)
	 */
	public static NewsFlag update(NewsFlag newsFlag, boolean merge,
		ServiceContext serviceContext) throws SystemException {
		return getPersistence().update(newsFlag, merge, serviceContext);
	}

	/**
	* Caches the news flag in the entity cache if it is enabled.
	*
	* @param newsFlag the news flag to cache
	*/
	public static void cacheResult(
		fr.smile.liferay.portlet.news.model.NewsFlag newsFlag) {
		getPersistence().cacheResult(newsFlag);
	}

	/**
	* Caches the news flags in the entity cache if it is enabled.
	*
	* @param newsFlags the news flags to cache
	*/
	public static void cacheResult(
		java.util.List<fr.smile.liferay.portlet.news.model.NewsFlag> newsFlags) {
		getPersistence().cacheResult(newsFlags);
	}

	/**
	* Creates a new news flag with the primary key. Does not add the news flag to the database.
	*
	* @param flagId the primary key for the new news flag
	* @return the new news flag
	*/
	public static fr.smile.liferay.portlet.news.model.NewsFlag create(
		long flagId) {
		return getPersistence().create(flagId);
	}

	/**
	* Removes the news flag with the primary key from the database. Also notifies the appropriate model listeners.
	*
	* @param flagId the primary key of the news flag to remove
	* @return the news flag that was removed
	* @throws fr.smile.liferay.portlet.news.NoSuchFlagException if a news flag with the primary key could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static fr.smile.liferay.portlet.news.model.NewsFlag remove(
		long flagId)
		throws com.liferay.portal.kernel.exception.SystemException,
			fr.smile.liferay.portlet.news.NoSuchFlagException {
		return getPersistence().remove(flagId);
	}

	public static fr.smile.liferay.portlet.news.model.NewsFlag updateImpl(
		fr.smile.liferay.portlet.news.model.NewsFlag newsFlag, boolean merge)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().updateImpl(newsFlag, merge);
	}

	/**
	* Finds the news flag with the primary key or throws a {@link fr.smile.liferay.portlet.news.NoSuchFlagException} if it could not be found.
	*
	* @param flagId the primary key of the news flag to find
	* @return the news flag
	* @throws fr.smile.liferay.portlet.news.NoSuchFlagException if a news flag with the primary key could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static fr.smile.liferay.portlet.news.model.NewsFlag findByPrimaryKey(
		long flagId)
		throws com.liferay.portal.kernel.exception.SystemException,
			fr.smile.liferay.portlet.news.NoSuchFlagException {
		return getPersistence().findByPrimaryKey(flagId);
	}

	/**
	* Finds the news flag with the primary key or returns <code>null</code> if it could not be found.
	*
	* @param flagId the primary key of the news flag to find
	* @return the news flag, or <code>null</code> if a news flag with the primary key could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static fr.smile.liferay.portlet.news.model.NewsFlag fetchByPrimaryKey(
		long flagId) throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().fetchByPrimaryKey(flagId);
	}

	/**
	* Finds all the news flags where entryId = &#63;.
	*
	* @param entryId the entry id to search with
	* @return the matching news flags
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<fr.smile.liferay.portlet.news.model.NewsFlag> findByEntryId(
		long entryId)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findByEntryId(entryId);
	}

	/**
	* Finds a range of all the news flags where entryId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param entryId the entry id to search with
	* @param start the lower bound of the range of news flags to return
	* @param end the upper bound of the range of news flags to return (not inclusive)
	* @return the range of matching news flags
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<fr.smile.liferay.portlet.news.model.NewsFlag> findByEntryId(
		long entryId, int start, int end)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findByEntryId(entryId, start, end);
	}

	/**
	* Finds an ordered range of all the news flags where entryId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param entryId the entry id to search with
	* @param start the lower bound of the range of news flags to return
	* @param end the upper bound of the range of news flags to return (not inclusive)
	* @param orderByComparator the comparator to order the results by
	* @return the ordered range of matching news flags
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<fr.smile.liferay.portlet.news.model.NewsFlag> findByEntryId(
		long entryId, int start, int end,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence()
				   .findByEntryId(entryId, start, end, orderByComparator);
	}

	/**
	* Finds the first news flag in the ordered set where entryId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param entryId the entry id to search with
	* @param orderByComparator the comparator to order the set by
	* @return the first matching news flag
	* @throws fr.smile.liferay.portlet.news.NoSuchFlagException if a matching news flag could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static fr.smile.liferay.portlet.news.model.NewsFlag findByEntryId_First(
		long entryId,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException,
			fr.smile.liferay.portlet.news.NoSuchFlagException {
		return getPersistence().findByEntryId_First(entryId, orderByComparator);
	}

	/**
	* Finds the last news flag in the ordered set where entryId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param entryId the entry id to search with
	* @param orderByComparator the comparator to order the set by
	* @return the last matching news flag
	* @throws fr.smile.liferay.portlet.news.NoSuchFlagException if a matching news flag could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static fr.smile.liferay.portlet.news.model.NewsFlag findByEntryId_Last(
		long entryId,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException,
			fr.smile.liferay.portlet.news.NoSuchFlagException {
		return getPersistence().findByEntryId_Last(entryId, orderByComparator);
	}

	/**
	* Finds the news flags before and after the current news flag in the ordered set where entryId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param flagId the primary key of the current news flag
	* @param entryId the entry id to search with
	* @param orderByComparator the comparator to order the set by
	* @return the previous, current, and next news flag
	* @throws fr.smile.liferay.portlet.news.NoSuchFlagException if a news flag with the primary key could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static fr.smile.liferay.portlet.news.model.NewsFlag[] findByEntryId_PrevAndNext(
		long flagId, long entryId,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException,
			fr.smile.liferay.portlet.news.NoSuchFlagException {
		return getPersistence()
				   .findByEntryId_PrevAndNext(flagId, entryId, orderByComparator);
	}

	/**
	* Finds the news flag where userId = &#63; and entryId = &#63; and value = &#63; or throws a {@link fr.smile.liferay.portlet.news.NoSuchFlagException} if it could not be found.
	*
	* @param userId the user id to search with
	* @param entryId the entry id to search with
	* @param value the value to search with
	* @return the matching news flag
	* @throws fr.smile.liferay.portlet.news.NoSuchFlagException if a matching news flag could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static fr.smile.liferay.portlet.news.model.NewsFlag findByU_E_V(
		long userId, long entryId, int value)
		throws com.liferay.portal.kernel.exception.SystemException,
			fr.smile.liferay.portlet.news.NoSuchFlagException {
		return getPersistence().findByU_E_V(userId, entryId, value);
	}

	/**
	* Finds the news flag where userId = &#63; and entryId = &#63; and value = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
	*
	* @param userId the user id to search with
	* @param entryId the entry id to search with
	* @param value the value to search with
	* @return the matching news flag, or <code>null</code> if a matching news flag could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static fr.smile.liferay.portlet.news.model.NewsFlag fetchByU_E_V(
		long userId, long entryId, int value)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().fetchByU_E_V(userId, entryId, value);
	}

	/**
	* Finds the news flag where userId = &#63; and entryId = &#63; and value = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
	*
	* @param userId the user id to search with
	* @param entryId the entry id to search with
	* @param value the value to search with
	* @return the matching news flag, or <code>null</code> if a matching news flag could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static fr.smile.liferay.portlet.news.model.NewsFlag fetchByU_E_V(
		long userId, long entryId, int value, boolean retrieveFromCache)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence()
				   .fetchByU_E_V(userId, entryId, value, retrieveFromCache);
	}

	/**
	* Finds all the news flags.
	*
	* @return the news flags
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<fr.smile.liferay.portlet.news.model.NewsFlag> findAll()
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findAll();
	}

	/**
	* Finds a range of all the news flags.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param start the lower bound of the range of news flags to return
	* @param end the upper bound of the range of news flags to return (not inclusive)
	* @return the range of news flags
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<fr.smile.liferay.portlet.news.model.NewsFlag> findAll(
		int start, int end)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findAll(start, end);
	}

	/**
	* Finds an ordered range of all the news flags.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param start the lower bound of the range of news flags to return
	* @param end the upper bound of the range of news flags to return (not inclusive)
	* @param orderByComparator the comparator to order the results by
	* @return the ordered range of news flags
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<fr.smile.liferay.portlet.news.model.NewsFlag> findAll(
		int start, int end,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findAll(start, end, orderByComparator);
	}

	/**
	* Removes all the news flags where entryId = &#63; from the database.
	*
	* @param entryId the entry id to search with
	* @throws SystemException if a system exception occurred
	*/
	public static void removeByEntryId(long entryId)
		throws com.liferay.portal.kernel.exception.SystemException {
		getPersistence().removeByEntryId(entryId);
	}

	/**
	* Removes the news flag where userId = &#63; and entryId = &#63; and value = &#63; from the database.
	*
	* @param userId the user id to search with
	* @param entryId the entry id to search with
	* @param value the value to search with
	* @throws SystemException if a system exception occurred
	*/
	public static void removeByU_E_V(long userId, long entryId, int value)
		throws com.liferay.portal.kernel.exception.SystemException,
			fr.smile.liferay.portlet.news.NoSuchFlagException {
		getPersistence().removeByU_E_V(userId, entryId, value);
	}

	/**
	* Removes all the news flags from the database.
	*
	* @throws SystemException if a system exception occurred
	*/
	public static void removeAll()
		throws com.liferay.portal.kernel.exception.SystemException {
		getPersistence().removeAll();
	}

	/**
	* Counts all the news flags where entryId = &#63;.
	*
	* @param entryId the entry id to search with
	* @return the number of matching news flags
	* @throws SystemException if a system exception occurred
	*/
	public static int countByEntryId(long entryId)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().countByEntryId(entryId);
	}

	/**
	* Counts all the news flags where userId = &#63; and entryId = &#63; and value = &#63;.
	*
	* @param userId the user id to search with
	* @param entryId the entry id to search with
	* @param value the value to search with
	* @return the number of matching news flags
	* @throws SystemException if a system exception occurred
	*/
	public static int countByU_E_V(long userId, long entryId, int value)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().countByU_E_V(userId, entryId, value);
	}

	/**
	* Counts all the news flags.
	*
	* @return the number of news flags
	* @throws SystemException if a system exception occurred
	*/
	public static int countAll()
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().countAll();
	}

	public static NewsFlagPersistence getPersistence() {
		if (_persistence == null) {
			_persistence = (NewsFlagPersistence)PortletBeanLocatorUtil.locate(fr.smile.liferay.portlet.news.service.ClpSerializer.SERVLET_CONTEXT_NAME,
					NewsFlagPersistence.class.getName());
		}

		return _persistence;
	}

	public void setPersistence(NewsFlagPersistence persistence) {
		_persistence = persistence;
	}

	private static NewsFlagPersistence _persistence;
}